package GUI;

import java.awt.*;
import java.awt.event.*;

public class TestActionEvent {
	public static void main(String[] args) {
		MyFrame f=new MyFrame(30,30,500,500);
		Button b1=new Button("Botton 1");
		Button b2=new Button("Botton 2");
		Monitor m=new Monitor();
		b1.setActionCommand("Butten 1 has been clicked");
		b1.addActionListener(m);
		b2.setActionCommand("Butten 2 has been clicked");
		b2.addActionListener(m);
		f.add(b1);
		f.add(b2);
	}

}

class Monitor implements ActionListener {
	public void actionPerformed(ActionEvent e) {
		System.out.println(e.getActionCommand());
	}
}

class MyFrame extends Frame {
	MyFrame(int x,int y,int width,int height) {
		setBounds(x, y, width, height);
		setLayout(new GridLayout(2, 1));
		setVisible(true);
	}
}